home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / acad / autolisp / pdist / pdist.lsp
Text File  |  1987-06-30  |  4KB  |  100 lines

  1. ; PDIST.LSP
  2. ; 3/25/1987
  3. ; By Philip M. Kreiker, Looking Glass Microproducts
  4. ;
  5. ; The information contained herein is being donated to the public domain
  6. ; soley for the benefit of licensed AutoCAD END USERS everywhere.  You are
  7. ; free to modify, or reproduce and distribute only in the un-altered
  8. ; original form, the information contained herein for ANY NON-COMMERCIAL
  9. ; use, provided such reproduction/disribution is NOT FOR PROFIT, and
  10. ; provided that with any such distribution, this NOTICE (or any portion
  11. ; thereof) is NOT REMOVED OR ALTERED from it's original content in ANY
  12. ; manner, shape, or form.
  13. ;
  14. ; You ARE NOT free to reproduce and/or distribute the information
  15. ; contained herein (regardless of medium or form of reproduction) for
  16. ; profit, or to include it or any portion thereof, as a part of any
  17. ; commercially marketed goods regardless of thier intended nature, scope,
  18. ; or form, without the expressed written permission of the author.
  19. ;
  20. ; If you seek such permission, it will be granted provided you furnish the
  21. ; author with ONE (1) fully-functional, licenseable sample of the finished
  22. ; product(s) in final marketed form.  In return for which you may solict
  23. ; and will recieve the author's objective opinions, advice and insight
  24. ; regarding any and all aspects of said product(s), free of charge, with
  25. ; appropriate and complete written assurance of non-disclosure.
  26. ;
  27. ; Additional information can be obtained
  28. ; by contacting
  29. ;
  30. ;                 Philip M. Kreiker
  31. ;                 Looking Glass Microproducts
  32. ;                 4233 West Eisenhower Boulevard
  33. ;                 Loveland, CO  80537
  34. ;                 (303) 669-2681
  35. ;
  36. ; Or, via electronic medium thru
  37. ;
  38. ;                 Compuserve ID: 70261,234
  39. ;
  40. ;   PDIST.LSP is a AutoLISP 2.6-based user defined command that measures
  41. ;   the distance between two points along a polyline.  This is accomplished
  42. ;   by BREAKING out the polyline segment to be measured, using the
  43. ;   AutoLISP 2.6 AREA command to report the length of the polyline,
  44. ;   and using the UNDO command to repair the break.
  45. ;
  46. ;
  47. ;   Some of the features of LEADER are:
  48. ;
  49. ;   To use PDIST, follow these steps;
  50. ;
  51. ;      Add all the AutoLISP code included in this file to your ACAD.LSP,
  52. ;      or LOAD in from within AutoCAD.
  53. ;
  54. ;     To measure the distance along a polyline, enter "PDIST" at the AutoCAD
  55. ;     Command:  prompt.
  56. ;
  57. ;     You will then be prompted to select a polyline.  Pick a point on
  58. ;     the polyline BETWEEN the two points you wish to measure.
  59. ;
  60. ;     You will then be prompted for the two points that define
  61. ;     the segment you wish to measure.
  62. ;
  63. ;     -- Philip M. Kreiker, Looking Glass Microproducts, 70261,234
  64. ;
  65. ;-----------------------------------------------------------------------------
  66. ;
  67. ; PDIST -- Determine the distance between two points on a polyline
  68. ;
  69. (defun c:pdist ( / e ename ent p0 p1 p2)
  70.   (if (setq e (entsel "\nSelect polyline:"))
  71.       (progn
  72.          (setq
  73.            p0    (cadr e)
  74.            ename (car e)
  75.            ent   (entget ename)
  76.          )
  77.          (if (= "POLYLINE" (cdr (assoc 0 ent)) )
  78.            (progn
  79.               (redraw ename 3)
  80.               (initget 1)
  81.               (setq p1 (getpoint "\nFrom point: "))
  82.               (setq p2 (getpoint "\nTo Point: "))
  83.               (redraw ename 4)
  84.               (setvar "cmdecho" 0)
  85.               (command
  86.                 "break" p0 "F" p1 "@"
  87.                 "break" p0 "F" p2 "@"
  88.                 "area" "E" p0
  89.                 "undo" 3
  90.               )
  91.               (princ "[done")
  92.            )
  93.            (princ "[not a polyline")
  94.          )
  95.       )
  96.       (princ "[none selected")
  97.   )
  98.   ']
  99. )
  100.